<template>
  <div class="banner">
    <!-- <img src="../assets/bannerimg.png" alt="" width="100%" height="100%"> -->
    <main>
      <van-swipe
        class="my-swipe"
        :autoplay="3000"
        indicator-color="white"
        height="80px"
        v-if="bannerlist.length"
      >
        <van-swipe-item v-for="(item,index) in bannerlist" :key="index"><img :src="item.bannerUrl"></van-swipe-item>
      </van-swipe>
      <!-- 骨架屏 占位置-->
      <van-skeleton v-else class="skeleton" title :row="3" />
    </main>
  </div>
</template>

<script>
import { banner_list } from "../api/index2";

export default {
  name: "Banner",
  data() {
    return {
      bannerlist: {},
    };
  },
  components: {},
  mounted() {
    banner_list().then((res) => {
      this.bannerlist = res.data.list;
      // console.log("this.bannerlist",this.bannerlist);
    });
  },
};
</script>

<style lang="css" scoped>
.banner {
  margin: 10px;
  /* background-color: blue; */
  height: 80px;
}
.my-swipe .van-swipe-item img {
  border-radius: 7px;
  height: 80px;
  display: block;
  width: 100%;
}

.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 80px;
  text-align: center;
  background-color: #39a9ed;
  border-radius: 7px;
}
</style>